package com.zyp.common.message.queue;

import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
 * @description: TODO
 * @author: zhenqiang.zhan
 * @create: 2018-11-17 10:39
 **/
@Component
@Slf4j
public class DeadMessageListener implements ChannelAwareMessageListener {

    @Override
    public void onMessage(Message message, Channel channel) throws IOException {
        log.info(message.toString());
        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
    }

}
